<template>
        <projApproval ref="projApproval" :that.sync="myThis">
          <div slot="headerMain">
              <el-dropdown @command="handleCommand">
                  <el-button type="primary" plain>
                    过桥报告模板B(角)<i class="el-icon-arrow-down el-icon--right"></i>
                  </el-button>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item command="projOverviewVisible|@|项目概况">项目概况</el-dropdown-item>
                    <el-dropdown-item command="busOperBankLoanVisible|@|企业经营、银行贷款情况">企业经营、银行贷款情况</el-dropdown-item>
                    <el-dropdown-item command="bridgeCrossLoanVisible|@|本次过桥贷款情况">本次过桥贷款情况</el-dropdown-item>
                    <el-dropdown-item command="operModeSuperVisible|@|操作方式及监管流程">操作方式及监管流程</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
                <el-dropdown  @command="handleCommand">
                    <el-button type="primary" plain>
                      报告模板B(角)<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                      <el-dropdown-item command="enterLoanSituVisible|@|企业贷款情况">企业贷款情况</el-dropdown-item>
                      <el-dropdown-item command="enterDescSituVisible|@|企业情况信息">企业情况信息</el-dropdown-item>
                      <el-dropdown-item command="enterManaDescSituVisible|@|企业经营情况分析">企业经营情况分析</el-dropdown-item>
                      <el-dropdown-item command="creditStatusVisible|@|资信状况">资信状况</el-dropdown-item>
                    </el-dropdown-menu>
                  </el-dropdown>
                  <el-dialog :title="title" :close-on-click-modal="false" width="70%" :visible.sync="projOverviewVisible" >
                      <projectOverView ref='projectOverView' @hiddenComponent="hiddenComponent"></projectOverView>
                  </el-dialog>
                  <el-dialog :title="title" :close-on-click-modal="false" width="70%" :visible.sync="busOperBankLoanVisible" >
                      <management ref='management' @hiddenComponent="hiddenComponent"></management>
                  </el-dialog>
                  <el-dialog :title="title" :close-on-click-modal="false" width="70%" :visible.sync="bridgeCrossLoanVisible" >
                      <bridgeCrossLoan ref='bridgeCrossLoan' @hiddenComponent="hiddenComponent"></bridgeCrossLoan>
                  </el-dialog>
                  <el-dialog :title="title" :close-on-click-modal="false" width="70%" :visible.sync="operModeSuperVisible" >
                      <operModeSuper ref='operModeSuper' @hiddenComponent="hiddenComponent"></operModeSuper>
                  </el-dialog>
                  <el-dialog :title="title" :close-on-click-modal="false" width="70%" :visible.sync="enterLoanSituVisible" >
                      <enterLoanSitu ref='enterLoanSitu' @hiddenComponent="hiddenComponent"></enterLoanSitu>
                  </el-dialog>

                  <el-dialog :title="title" :close-on-click-modal="false" width="70%" :visible.sync="enterDescSituVisible" >
                      <enterDescSitu ref='enterDescSitu' @hiddenComponent="hiddenComponent"></enterDescSitu>
                  </el-dialog>
                  <el-dialog :title="title" :close-on-click-modal="false" width="70%" :visible.sync="enterManaDescSituVisible" >
                      <enterManaDescSitu ref='enterManaDescSitu' @hiddenComponent="hiddenComponent"></enterManaDescSitu>
                  </el-dialog>
                  <el-dialog :title="title" :close-on-click-modal="false" width="70%" :visible.sync="creditStatusVisible" >
                      <creditStatus ref='creditStatus' @hiddenComponent="hiddenComponent"></creditStatus>
                  </el-dialog>
               

          </div>
          <el-card slot="main">
                <projHandleDisplay ref='projHandleDisplay'></projHandleDisplay>
          </el-card>
          <el-tab-pane label="材料收集" slot="materCollection" name="material">
            <projMateComponent ref="projMateComponent" :projId.sync="projId"></projMateComponent>
          </el-tab-pane>
          
         

        </projApproval>
 </template>
      <script>
        import projApproval from '@/pages/biz/proj/common/ProjApproval'
         
        export default {
          name: 'ProjApproval',
          components:{
            projHandleDisplay: require("@/pages/biz/proj/projDisplay/projHandleDisplay.vue").default,
            projectOverView: require("@/pages/biz/angle/ProjectOverView.vue").default,
            management: require("@/pages/biz/angle/Management.vue").default,
            bridgeCrossLoan: require("@/pages/biz/angle/bridgeCrossLoan.vue").default,
            operModeSuper: require("@/pages/biz/angle/operModeSuper.vue").default,
            enterLoanSitu: require("@/pages/biz/angle/enterLoanSitu.vue").default,
            enterDescSitu: require("@/pages/biz/angle/enterDescSitu.vue").default,
            enterManaDescSitu: require("@/pages/biz/angle/enterManaDescSitu.vue").default,
            creditStatus: require("@/pages/biz/angle/creditStatus.vue").default,
            projApproval,
            projMateComponent: require("@/pages/biz/proj/proj-mateB.vue").default,
          },
          data(){
            return {
              myThis: this,
              title:'',
              viewHide : true,
              projOverviewVisible:false,
              busOperBankLoanVisible:false,
              bridgeCrossLoanVisible:false,
              operModeSuperVisible:false,
              enterLoanSituVisible:false,
              enterDescSituVisible:false,
              enterManaDescSituVisible:false,
              creditStatusVisible:false,
              projId:'',
            }
          },
          mounted() {
            this.loanBusinessInfo();
          },
          methods: {
            hiddenComponent(){
              this.projOverviewVisible=false;
              this.busOperBankLoanVisible=false;
              this.bridgeCrossLoanVisible=false;
              this.operModeSuperVisible=false;
              this.enterLoanSituVisible=false;
              this.enterDescSituVisible=false;
              this.enterManaDescSituVisible=false;
              this.creditStatusVisible=false;
            },
            handleCommand(command) {
             let showDialog="";
             let title="";
             let data= command.split("|@|");
             for(var i=0;i<data.length;i++){
                showDialog=data[0];
                title=data[1];
             }
             this.title=title;
             this.projOverviewVisible="projOverviewVisible"==showDialog;
             this.busOperBankLoanVisible="busOperBankLoanVisible"==showDialog;
             this.bridgeCrossLoanVisible="bridgeCrossLoanVisible"==showDialog;
             this.operModeSuperVisible="operModeSuperVisible"==showDialog;
             this.enterLoanSituVisible="enterLoanSituVisible"==showDialog;
             this.enterDescSituVisible="enterDescSituVisible"==showDialog;
             this.enterManaDescSituVisible="enterManaDescSituVisible"==showDialog;
             this.creditStatusVisible="creditStatusVisible"==showDialog;
             this.$nextTick(() => {
               if(this.projOverviewVisible){
                  this.$refs.projectOverView.init(this.projId);
               }
               if(this.busOperBankLoanVisible){
                  this.$refs.management.init(this.projId);
               }
               if(this.bridgeCrossLoanVisible){
                  this.$refs.bridgeCrossLoan.init(this.projId);
               }
               if(this.operModeSuperVisible){
                  this.$refs.operModeSuper.init(this.projId);
               }
               if(this.enterLoanSituVisible){
                  this.$refs.enterLoanSitu.init(this.projId);
               }
               if(this.enterDescSituVisible){
                  this.$refs.enterDescSitu.init(this.projId);
               }
               if(this.enterManaDescSituVisible){
                  this.$refs.enterManaDescSitu.init(this.projId);
               }
               if(this.creditStatusVisible){
                  this.$refs.creditStatus.init(this.projId);
               }
            })
            
            },
            loanBusinessInfo(){
              this.$api
              .post("wf/common/approval?id=" + this.$route.query.id)
              .then(res => {
                if (res.status === "0") {
                  if(res.data != null){
                    let projectId = res.data.businessRelation.mid;
                    this.projId=projectId;
                    this.$refs.projHandleDisplay.innit(projectId);
                    this.$refs.projMateComponent.initialization(projectId);
                  }
                }
              });
      
              }
              
            
            
          }
        }
      </script>
      
      <style scoped>
      
      </style>
